//
//  LoadingView.m
//  ChatForHot
//
//  Created by FLY on 2018/10/9.
//  Copyright © 2018年 FLY. All rights reserved.
//

#import "LoadingView.h"

@implementation LoadingView

- (instancetype)init{
    
    self = [super init];
    if (self) {
        
        [self addSubview:self.loadImgView];
        
        [self.loadImgView mas_updateConstraints:^(MASConstraintMaker *make) {
            
            make.center.equalTo(self);
        }];
        
    }
    return self;
}
- (UIImageView *)loadImgView{
    
    if (_loadImgView == nil) {
        
        _loadImgView = [[UIImageView alloc]init];
        _loadImgView.animationImages = [self HOTCHATGetTheImg];
        _loadImgView.animationDuration = 2;
    }
    return _loadImgView;
}
- (NSArray *)HOTCHATGetTheImg{
    
    NSMutableArray *imgArr = [NSMutableArray new];
    NSString *picStr = @"";
    UIImage *image = nil;
    for (int i = 1; i <= 40; i ++) {
        
        picStr = [NSString stringWithFormat:@"loadgif%d",i];
        image = [UIImage imageNamed:picStr];
        if (image != nil) {
            
            [imgArr addObject:image];
        }
    }
    return imgArr;
}
- (void)HOTCHATstopAni{
    
    [self.loadImgView stopAnimating];
}
- (void)HOTCHATstartAni{
    
    [self.loadImgView startAnimating];
}
@end
